import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ytbusiness/config/style.dart';
import 'package:ytbusiness/utils/screen_adaptation.dart';
import 'package:ytbusiness/widgets/widgets.dart';

///询价中
class ProcurementEnquiry extends StatefulWidget {
  @override
  _ProcurementEnquiryState createState() => _ProcurementEnquiryState();
}

class _ProcurementEnquiryState extends State<ProcurementEnquiry> {
  List<String> titleList = ["订单编号", "订单时间", "VIN", "车辆型号", "订单状态"];
  List<String> contentList = [
    "183819993923",
    "2020-11-23 15:00",
    "LVHQO6652G6043020",
    "本田 DJFH 2012",
    "询价中"
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: YTStyle.bgColor,
      appBar: customAppBar(context, title: "询价中", elevation: 0.5),
      body: CustomScrollView(
        slivers: [
          SliverToBoxAdapter(
            child: Container(
              color: Colors.white,
              padding: EdgeInsets.only(
                  top: setWidth(10),
                  left: setWidth(15),
                  right: setWidth(15),
                  bottom: setWidth(10)),
              child: ListView.builder(
                  physics: NeverScrollableScrollPhysics(),
                  shrinkWrap: true,
                  itemCount: titleList.length,
                  itemBuilder: (context, index) {
                    return Container(
                      margin: EdgeInsets.only(
                          top: setWidth(10), bottom: setWidth(10)),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Container(
                            child: Text(
                              "${titleList[index]}:",
                              style: TextStyle(
                                  color: Color(0xff999999),
                                  fontSize: setWidth(15)),
                            ),
                            width: setWidth(70),
                          ),
                          Expanded(
                            child: Container(
                              child: Text(
                                "${contentList[index]}",
                                style: TextStyle(
                                    color: titleList[index] == "订单状态"
                                        ? Color(0xffFF4D4D)
                                        : Color(0xff333333),
                                    fontSize: setWidth(15)),
                              ),
                            ),
                          ),
                        ],
                      ),
                    );
                  }),
            ),
          ),
          SliverToBoxAdapter(
            child: Container(
              margin: EdgeInsets.only(top: setWidth(15)),
              padding: EdgeInsets.only(top: setWidth(18), bottom: setWidth(18)),
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(8)),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Container(
                    padding: EdgeInsets.only(left: setWidth(15)),
                    child: Text(
                      "询价信息",
                      style: TextStyle(
                          color: Color(0xff333333),
                          fontSize: setWidth(15),
                          fontWeight: FontWeight.w500),
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(
                        top: setWidth(13), bottom: setWidth(15)),
                    height: setWidth(0.5),
                    color: Color(0xffF0F0F0),
                  ),
                  Container(
                    color: Colors.white,
                    child: ListView.builder(
                        physics: NeverScrollableScrollPhysics(),
                        shrinkWrap: true,
                        itemCount: titleList.length,
                        itemBuilder: (context, index) {
                          return _goodsItem();
                        }),
                  ),
                ],
              ),
            ),
          )
        ],
      ),
    );
  }

  Widget _goodsItem() {
    return Container(
      color: Colors.white,
      padding: EdgeInsets.only(left: setWidth(15), right: setWidth(15)),
      margin: EdgeInsets.only(bottom: setWidth(12)),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                height: setWidth(90),
                width: setWidth(90),
                decoration: BoxDecoration(
                    color: Color(0xffC4C4C4),
                    borderRadius: BorderRadius.circular(6)),
              ),
              SizedBox(
                width: setWidth(10),
              ),
              Expanded(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Container(
                      child: Text(
                        "前挡泥板-右后翼子板",
                        style: TextStyle(
                            color: Color(0xff323232), fontSize: setSp(15)),
                        maxLines: 2,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: setWidth(5)),
                      child: Text(
                        "零件编号：50260TJFJ01",
                        style: TextStyle(
                            color: Color(0xff989898), fontSize: setSp(14)),
                        maxLines: 2,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: setWidth(5)),
                      child: Text(
                        "属性：原厂原包",
                        style: TextStyle(
                            color: Color(0xff989898), fontSize: setSp(14)),
                        maxLines: 2,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: setWidth(5)),
                      child: Text("x1",
                          style: TextStyle(
                              color: Color(0xff323232), fontSize: setSp(14))),
                    ),
                  ],
                ),
              ),
            ],
          ),
          Container(
            margin: EdgeInsets.only(top: setWidth(20), bottom: setWidth(20)),
            color: Color(0xffF0F0F0),
            height: setWidth(0.5),
          )
        ],
      ),
    );
  }
}
